<template>
  <div>
    <div v-for="x in AuditList">
      <p v-for="(a,b,index) in x.message">
        {{b}} : {{a}}
      </p>
      <a-button type="primary" @click="agree(x.id)">同意</a-button>
      &emsp;
      <a-button type="danger" @click="refuse(x.id)">拒绝</a-button>


    </div>


  </div>
</template>

<script>
export default {
name: "audit_workorder",
  data(){
    return{
      uid:localStorage.getItem('uid'),
      AuditList:[],

    }
  },
  methods:{
    getAudit(){
      this.$axios.get('http://127.0.0.1:8000/z/check/?uid='+this.uid)
      .then(res=>{
        this.AuditList=res.data
        console.log(res.data)
      })
    },
    agree(id){
      this.$axios.post('http://127.0.0.1:8000/z/check/?uid='+this.uid+'&id='+id,{
        'start':'2'
      })
      .then(res=>{
        console.log(res.data)
      })
    },
    refuse(id){
      this.$axios.post('http://127.0.0.1:8000/z/check/?uid='+this.uid+'&id='+id,{
        'start':'3'
      })
        .then(res=>{
          console.log(res.data)
        })
    },

  },
  mounted() {
    this.getAudit();
  }
}
</script>

<style scoped>

</style>
